<template>
  <div>
    <div class="detail">
      <p class="flex-b">
        标题：{{ state.detail.biaoti }}
        <el-button @click="router.go(-1)" type="primary" size="large"
          >返回</el-button
        >
      </p>
      <p>类型：{{ state.dicLabel }}</p>
      <p class="flex-c" style="justify-content: start">
        文件：<img
          v-if="state.detail?.wenjian && state.detail?.wenjian?.length > 0"
          style="max-width: 250px"
          :src="state.detail.wenjian[0].filePath"
          alt=""
        />
      </p>
      <p>状态：{{ state.detail?.shangjia?.code == 1 ? "已上架" : "已下架" }}</p>
      <p>资讯内容：</p>
      <div class="mt20" v-html="state.detail.baogaoneirong"></div>
    </div>
  </div>
</template>
<script setup>
import { GetReport } from "@/api/report";
import { reactive } from "vue";
import { GetDictionaryTree } from "@/api/system";
import { useRoute, useRouter } from "vue-router";
const route = useRoute();
const router = useRouter();
const state = reactive({
  detail: {},
  type: [],
  dicLabel: "",
});
const GetList = () => {
  GetDictionaryTree({ dicModel: "hangyebaogaoleixing" }).then((res) => {
    if (res.code == 4201) {
      state.type = res.data;
      GetReport({ id: route.query.id }).then((res) => {
        if (res.code === 4201) {
          state.detail = res.data;
          state.type.forEach((item) => {
            if (item.dicValue == state.detail.leixing) {
              state.dicLabel = item.dicLabel;
            }
          });
        }
      });
    }
  });
};
GetList();
</script>
<style lang="scss" scoped>
.detail {
  padding: 1px 30px 30px 30px;
  font-size: 16px;
  color: #000;
  p {
    margin-top: 30px;
  }
}
</style>
